#include <algorithm>
#include <iostream>
#include <cmath>

/**
 * PAT A 1081 Rational Sum
 */

int gcd(int a, int b) {
    while (b != 0) {
        int m = a % b;
        a = b;
        b = m;
    }
    return a;
}

struct Rational {
    int num, denom;

    Rational() {}

    Rational(int num, int denom) : num(num), denom(denom) {}

    Rational operator+(const Rational& other) const {
        int newDenom = denom * other.denom;
        int newNum = num * other.denom + other.num * denom;
        int factor = gcd(newNum, newDenom);
        return Rational(newNum / factor, newDenom / factor);
    }

    void print() const {
        int i = num / denom;
        if (num % denom == 0)
            printf("%d\n", i);
        else if (i == 0)
            printf("%d/%d", num % denom, denom);
        else
            printf("%d %d/%d\n", i, num % denom, denom);
    }
};

int main() {
    int n;
    scanf("%d", &n);
    Rational result;
    scanf("%d/%d", &result.num, &result.denom);
    for (int i = 1; i < n; i++) {
        Rational added;
        scanf("%d/%d", &added.num, &added.denom);
        result = result + added;
    }
    result.print();
    return 0;
}